home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2000 July / macformat-092.iso / MacFormat 92 CD / Shareware Plus / Utilities / FolderSynchronizer 1.8.9 / PlugIn / SR / 00002_sFiles.ls < prev    next >
Encoding:
Text File  |  2000-03-23  |  2.8 KB  |  105 lines

  1. on ReadLogText
  2.   global gShortFlag, gCurrLog, gShortReportList, gCurrLogText, gTotLog, gCurrLine, gTotLines, gMaxLines, gLogPathList, gArancio
  3.   set gCurrLine to 1
  4.   if gTotLog > 1 then
  5.     set NumLog to " " & string(gCurrLog)
  6.   else
  7.     set NumLog to EMPTY
  8.   end if
  9.   if gShortFlag then
  10.     set gCurrLogText to string(getAt(gShortReportList, gCurrLog))
  11.     set gTotLines to the number of lines in gCurrLogText
  12.     set the title of window (the pathName & the movieName) to "Short Log" & NumLog
  13.   else
  14.     LeggiFileLog()
  15.     set gTotLines to the number of lines in gCurrLogText
  16.     set theFileName to ExtractFileNameFromPath(getAt(gLogPathList, gCurrLog))
  17.     set the title of window (the pathName & the movieName) to "Log File" & NumLog & ":" && theFileName
  18.   end if
  19.   put line 1 to gMaxLines of gCurrLogText into field "fReport"
  20. end
  21.  
  22. on LeggiFileLog
  23.   global gCurrLog, gLogPathList, gCurrLogText
  24.   if voidp(gLogPathList) then
  25.     exit
  26.   end if
  27.   set maxListPath to count(gLogPathList)
  28.   if maxListPath < 1 then
  29.     exit
  30.   end if
  31.   if (gCurrLog < 1) or (gCurrLog > maxListPath) then
  32.     exit
  33.   end if
  34.   set theLogFilePath to getAt(gLogPathList, gCurrLog)
  35.   set myFileName to QUOTE & ExtractFileNameFromPath(theLogFilePath) & QUOTE
  36.   if OSIsDirectory(theLogFilePath) = 0 then
  37.     if (GetType(theLogFilePath) = "TEXT") and (GetCreator(theLogFilePath) = "ttxt") then
  38.       set file to new(xtra("fileio"))
  39.       if objectp(file) then
  40.         openFile(file, theLogFilePath, 1)
  41.         set gCurrLogText to readFile(file)
  42.         closeFile(file)
  43.         set file to 0
  44.       end if
  45.     else
  46.       set gCurrLogText to "Type or Creator of File Log" && myFileName && "not valid."
  47.     end if
  48.   else
  49.     set gCurrLogText to "File Log" && myFileName && "not available."
  50.   end if
  51. end
  52.  
  53. on ExtractFileNameFromPath myPath
  54.   global gSep
  55.   set oldDelimiter to the itemDelimiter
  56.   set the itemDelimiter to gSep
  57.   if the last char in myPath = gSep then
  58.     delete char -30000 of myPath
  59.   end if
  60.   set myReturn to the last item in myPath
  61.   set the itemDelimiter to oldDelimiter
  62.   return myReturn
  63. end
  64.  
  65. on GetType myFile
  66.   set myType to Sinistra(OSGetFileInfo(myFile), 4)
  67.   return myType
  68. end
  69.  
  70. on GetCreator myFile
  71.   set myCreator to Destra(OSGetFileInfo(myFile), 4)
  72.   return myCreator
  73. end
  74.  
  75. on Sinistra stringa, Valore
  76.   set lun to length(stringa)
  77.   if Valore > lun then
  78.     set Valore to lun
  79.   end if
  80.   if (Valore > 0) and (Valore <= lun) then
  81.     return char 1 to Valore of stringa
  82.   end if
  83. end
  84.  
  85. on Centro stringa, inizio, fine
  86.   set lun to length(stringa)
  87.   if voidp(fine) then
  88.     set fine to lun
  89.   end if
  90.   if (inizio > 0) and (fine <= lun) then
  91.     return char inizio to fine of stringa
  92.   end if
  93. end
  94.  
  95. on Destra stringa, Valore
  96.   set lun to length(stringa)
  97.   if Valore > lun then
  98.     set Valore to lun
  99.   end if
  100.   if (Valore >= 0) and (Valore <= lun) then
  101.     set pos to lun - Valore + 1
  102.     return char pos to lun of stringa
  103.   end if
  104. end
  105.